#pragma once
#include "stdafx.h"

#include <map>

class Application;
class GameController;

struct ButtonInfo
  {
  ButtonInfo();
  ButtonInfo(const std::string &i_handler, const std::string &i_button_normal, const std::string &i_button_active);

  std::string handler;
  std::string button_normal;
  std::string button_active;
  };

class Menu
  {
  public:
    Menu(Application& i_app, GameController& i_game_controller, bool i_visible);
    bool IsMenuHere(double i_mouse_coord_x, double i_mouse_coord_y) const;

    void ResetButtonCaptions();

    ~Menu();
  private:
    void _Initialize();
    void _InitButtons();
    void _UpdateLabels();

    void _SetButtonCaption(const CEGUI::String &i_button_name, const CEGUI::String &i_button_caption);

    void _HandleStateChange(const CEGUI::String &i_handler_name);

		void _CEGUI_NewGame();
    void _CEGUI_SaveWorld(int i_target_save);
		void _CEGUI_LoadWorld(int i_number_loaded);

    bool _CEGUI_HandleStateButtonClick(const CEGUI::EventArgs&);
  private:
    double m_min_x;
    double m_min_y;
    double m_max_x;
    double m_max_y;
    Application& m_app;
    GameController& m_game_controller;
    bool m_is_visible;
    std::map<CEGUI::String, ButtonInfo> m_buttons_map;
  };
